home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / stddef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-07  |  7.1 KB  |  266 lines

  1. #ifndef _STDDEF_H
  2. #ifndef _STDDEF_H_
  3. #ifndef _ANSI_STDDEF_H
  4. #ifndef __STDDEF_H__
  5.  
  6. /* Any one of these symbols __need_* means that GNU libc
  7.    wants us just to define one data type.  So don't define
  8.    the symbols that indicate this file's entire job has been done.  */
  9. #if (!defined(__need_wchar_t) && !defined(__need_size_t)    \
  10.      && !defined(__need_ptrdiff_t) && !defined(__need_NULL))
  11. #define _STDDEF_H
  12. #define _STDDEF_H_
  13. /* snaroff@next.com says the NeXT needs this.  */
  14. #define _ANSI_STDDEF_H
  15. /* Irix 5.1 needs this.  */
  16. #define __STDDEF_H__
  17. #endif
  18.  
  19. #ifndef __sys_stdtypes_h
  20. /* This avoids lossage on SunOS but only if stdtypes.h comes first.
  21.    There's no way to win with the other order!  Sun lossage.  */
  22.  
  23. /* On 4.3bsd-net2, make sure ansi.h is included, so we have
  24.    one less case to deal with in the following.  */
  25. #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__)
  26. #include <machine/ansi.h>
  27. #endif
  28.  
  29. /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
  30.     defined if the corresponding type is *not* defined.  */
  31. #ifdef _ANSI_H_
  32. #ifndef _SIZE_T_
  33. #define _SIZE_T
  34. #endif
  35. #ifndef _PTRDIFF_T_
  36. #define _PTRDIFF_T
  37. #endif
  38. /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
  39.    instead of _WCHAR_T_. */
  40. #ifndef _WCHAR_T_
  41. #ifndef _BSD_WCHAR_T_
  42. #define _WCHAR_T
  43. #endif
  44. #endif
  45. /* Undef _FOO_T_ if we are supposed to define foo_t.  */
  46. #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
  47. #undef _PTRDIFF_T_
  48. #endif
  49. #if defined (__need_size_t) || defined (_STDDEF_H_)
  50. #undef _SIZE_T_
  51. #endif
  52. #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  53. #undef _WCHAR_T_
  54. #endif
  55. #endif /* _ANSI_H_ */
  56.  
  57. /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
  58.    Just ignore it.  */
  59. #if defined (__sequent__) && defined (_PTRDIFF_T_)
  60. #undef _PTRDIFF_T_
  61. #endif
  62.  
  63. /* In case nobody has defined these types, but we aren't running under
  64.    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
  65.    __WCHAR_TYPE__ have reasonable values.  This can happen if the
  66.    parts of GCC is compiled by an older compiler, that actually
  67.    include gstddef.h, such as collect2.  */
  68.  
  69. /* Signed type of difference of two pointers.  */
  70.  
  71. /* Define this type if we are doing the whole job,
  72.    or if we want this type in particular.  */
  73. #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
  74. #ifndef _PTRDIFF_T    /* in case <sys/types.h> has defined it. */
  75. #ifndef _T_PTRDIFF_
  76. #ifndef _T_PTRDIFF
  77. #ifndef __PTRDIFF_T
  78. #ifndef _PTRDIFF_T_
  79. #ifndef ___int_ptrdiff_t_h
  80. #ifndef _GCC_PTRDIFF_T
  81. #define _PTRDIFF_T
  82. #define _T_PTRDIFF_
  83. #define _T_PTRDIFF
  84. #define __PTRDIFF_T
  85. #define _PTRDIFF_T_
  86. #define ___int_ptrdiff_t_h
  87. #define _GCC_PTRDIFF_T
  88. #ifndef __PTRDIFF_TYPE__
  89. #define __PTRDIFF_TYPE__ long int
  90. #endif
  91. typedef __PTRDIFF_TYPE__ ptrdiff_t;
  92. #endif /* _GCC_PTRDIFF_T */
  93. #endif /* ___int_ptrdiff_t_h */
  94. #endif /* _PTRDIFF_T_ */
  95. #endif /* __PTRDIFF_T */
  96. #endif /* _T_PTRDIFF */
  97. #endif /* _T_PTRDIFF_ */
  98. #endif /* _PTRDIFF_T */
  99.  
  100. /* If this symbol has done its job, get rid of it.  */
  101. #undef    __need_ptrdiff_t
  102.  
  103. #endif /* _STDDEF_H or __need_ptrdiff_t.  */
  104.  
  105. /* Unsigned type of `sizeof' something.  */
  106.  
  107. /* Define this type if we are doing the whole job,
  108.    or if we want this type in particular.  */
  109. #if defined (_STDDEF_H) || defined (__need_size_t)
  110. #ifndef _SIZE_T    /* in case <sys/types.h> has defined it. */
  111. #ifndef _SYS_SIZE_T_H
  112. #ifndef _T_SIZE_
  113. #ifndef _T_SIZE
  114. #ifndef __SIZE_T
  115. #ifndef _SIZE_T_
  116. #ifndef _SIZE_T_DEFINED_
  117. #ifndef ___int_size_t_h
  118. #ifndef _GCC_SIZE_T
  119. #ifndef _SIZET_
  120. #ifndef __size_t
  121. #define _SIZE_T
  122. #define _SYS_SIZE_T_H
  123. #define _T_SIZE_
  124. #define _T_SIZE
  125. #define __SIZE_T
  126. #define _SIZE_T_
  127. #define _SIZE_T_DEFINED_
  128. #define ___int_size_t_h
  129. #define _GCC_SIZE_T
  130. #define _SIZET_
  131. #define __size_t
  132. #ifndef __SIZE_TYPE__
  133. #define __SIZE_TYPE__ long unsigned int
  134. #endif
  135. #if !(defined (__GNUG__) && defined (size_t))
  136. typedef __SIZE_TYPE__ size_t;
  137. #endif /* !(defined (__GNUG__) && defined (size_t)) */
  138. #endif /* __size_t */
  139. #endif /* _SIZET_ */
  140. #endif /* _GCC_SIZE_T */
  141. #endif /* ___int_size_t_h */
  142. #endif /* _SIZE_T_DEFINED_ */
  143. #endif /* _SIZE_T_ */
  144. #endif /* __SIZE_T */
  145. #endif /* _T_SIZE */
  146. #endif /* _T_SIZE_ */
  147. #endif /* _SYS_SIZE_T_H */
  148. #endif /* _SIZE_T */
  149. #undef    __need_size_t
  150. #endif /* _STDDEF_H or __need_size_t.  */
  151.  
  152.  
  153. /* Wide character type.
  154.    Locale-writers should change this as necessary to
  155.    be big enough to hold unique values not between 0 and 127,
  156.    and not (wchar_t) -1, for each defined multibyte character.  */
  157.  
  158. /* Define this type if we are doing the whole job,
  159.    or if we want this type in particular.  */
  160. #if defined (_STDDEF_H) || defined (__need_wchar_t)
  161. #ifndef _WCHAR_T
  162. #ifndef _T_WCHAR_
  163. #ifndef _T_WCHAR
  164. #ifndef __WCHAR_T
  165. #ifndef _WCHAR_T_
  166. #ifndef _WCHAR_T_DEFINED_
  167. #ifndef _WCHAR_T_H
  168. #ifndef ___int_wchar_t_h
  169. #ifndef __INT_WCHAR_T_H
  170. #ifndef _GCC_WCHAR_T
  171. #define _WCHAR_T
  172. #define _T_WCHAR_
  173. #define _T_WCHAR
  174. #define __WCHAR_T
  175. #define _WCHAR_T_
  176. #define _WCHAR_T_DEFINED_
  177. #define _WCHAR_T_H
  178. #define ___int_wchar_t_h
  179. #define __INT_WCHAR_T_H
  180. #define _GCC_WCHAR_T
  181.  
  182. /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
  183.    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
  184.    symbols in the _FOO_T_ family, stays defined even after its
  185.    corresponding type is defined).  If we define wchar_t, then we
  186.    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
  187.    we undef _WCHAR_T_, then we must also define rune_t, since 
  188.    headers like runetype.h assume that if machine/ansi.h is included,
  189.    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
  190.    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
  191.    the same type." */
  192. #ifdef _BSD_WCHAR_T_
  193. #undef _BSD_WCHAR_T_
  194. #ifdef _BSD_RUNE_T_
  195. #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
  196. typedef _BSD_RUNE_T_ rune_t;
  197. #endif
  198. #endif
  199. #endif
  200.  
  201. #ifndef __WCHAR_TYPE__
  202. #define __WCHAR_TYPE__ int
  203. #endif
  204. typedef __WCHAR_TYPE__ wchar_t;
  205. #endif
  206. #endif
  207. #endif
  208. #endif
  209. #endif
  210. #endif
  211. #endif
  212. #endif
  213. #endif
  214. #endif
  215. #undef    __need_wchar_t
  216. #endif /* _STDDEF_H or __need_wchar_t.  */
  217.  
  218. /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
  219.     are already defined.  */
  220. #ifdef _ANSI_H_
  221. /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
  222.     are probably typos and should be removed before 2.7 is released.  */
  223. #ifdef _GCC_PTRDIFF_T_
  224. #undef _PTRDIFF_T_
  225. #endif
  226. #ifdef _GCC_SIZE_T_
  227. #undef _SIZE_T_
  228. #endif
  229. #ifdef _GCC_WCHAR_T_
  230. #undef _WCHAR_T_
  231. #endif
  232. /*  The following ones are the real ones.  */
  233. #ifdef _GCC_PTRDIFF_T
  234. #undef _PTRDIFF_T_
  235. #endif
  236. #ifdef _GCC_SIZE_T
  237. #undef _SIZE_T_
  238. #endif
  239. #ifdef _GCC_WCHAR_T
  240. #undef _WCHAR_T_
  241. #endif
  242. #endif /* _ANSI_H_ */
  243.  
  244. #endif /* __sys_stdtypes_h */
  245.  
  246. /* A null pointer constant.  */
  247.  
  248. #if defined (_STDDEF_H) || defined (__need_NULL)
  249. #undef NULL        /* in case <stdio.h> has defined it. */
  250. #define NULL ((void *)0)
  251. #endif    /* NULL not defined and <stddef.h> or need NULL.  */
  252. #undef    __need_NULL
  253.  
  254. #ifdef _STDDEF_H
  255.  
  256. /* Offset of member MEMBER in a struct of type TYPE.  */
  257.  
  258. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  259.  
  260. #endif /* _STDDEF_H was defined this time */
  261.  
  262. #endif /* __STDDEF_H__ was not defined before */
  263. #endif /* _ANSI_STDDEF_H was not defined before */
  264. #endif /* _STDDEF_H_ was not defined before */
  265. #endif /* _STDDEF_H was not defined before */
  266.